package com.kygeng.springframework.bean;

import java.util.HashMap;
import java.util.Map;

public class UserDao {

    private Map<String, String> hashMap = new HashMap<>();

    public void initDataMethod() {
        System.out.println("准备执行：init-method");
        hashMap.put("10002", "八杯水");
        hashMap.put("10003", "阿毛");
        System.out.println("执行完毕：init-method，此时 hashMap=" + hashMap.toString());
    }

    public void destroyDataMethod() {
        System.out.println("执行：destroy-method");
        hashMap.clear();
        System.out.println("执行完毕：destroy-method，此时 hashMap=" + hashMap.toString());
    }

    public String queryUserName(String uId) {
        return hashMap.get(uId);
    }
}
